<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>
<body>
    <div id="app">
        <p>指令是一个特殊的标签属性，格式为v-xx。根据指令的值来操作dom</p>
        <p>v-text</p>
        <p v-text="msg2"></p>
        <p>{{msg1}}</p>
        <p>v-html</p>
        <p v-html="msg2"></p>
        <hr>
        <!-- $event vue内部封装好的事件对象，其实就是原生js中的event -->
        <button v-on:click="fn1('all', $event)">click</button>
        <!-- 语法糖、语法糖衣：特殊的缩写 -->
        <!-- 显式传参 -->
        <button @click="fn1('min')">click</button>
        <br>
        <!-- 隐式传参 -->
        <button @click="fn2">click-2</button>
        <input v-model="val1" @keyup="fn3">
    </div>
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                msg1: '昨天下雨好凉凉~',
                msg2: '<mark>马克笔</mark>',
                val1: ''
            },
            methods: {
                fn1(type, e) {
                    console.log(type);
                    console.log(e);
                    console.log('我是被v-on调用的。。。');
                },
                fn2(e) {
                    console.log(e);
                },
                fn3(e) {
                    // 回车键的keycode是13
                    console.log(e.keyCode);
                    console.log(this.val1);
                }
            }
        })
    </script>
</body>
</html>